<style type="text/css">
<!--
.style1 {
	color: #FF0000;
	font-weight: bold;
}
body,td,th {
	font-family: Verdana, Arial, Helvetica, sans-serif;
	font-size: 11px;
}
.style4 {font-size: 24px}
-->
</style>
<?php
	include ("sql.inc.php");
	include ("../header.php");
	$q_subject		=	$_GET['sub'];
	$q_department	=	$_GET['dep'];
	$q_sem			=	$_GET['sem'];
	$q_topic		=	$_GET['topic'];
	
	//Protect data passing from SQL injection
	
	$q_subject = clean($q_subject);
	$q_department = clean($q_department);
	$q_sem	=	clean($q_sem);
	$q_topic = clean($q_topic);
	
	$count = 1;
	while ($count <=4)
	{	
		if (!(isset($_POST['answer_'.$count.'']))){
			$answer[$count]=1;
		} else {
			$answer[$count] = $_POST['answer_'.$count.''];
		}
		$count++;
	}
	
	$count = 1;
	$marking=0;
	while ($count <= 4)
	{	
		$id = $answer[$count];
		$sql_get_point="SELECT ans_point FROM answer WHERE ans_id='$id'";
		$get_point=mysql_query($sql_get_point);
		$result=mysql_fetch_assoc($get_point);
		$point=$result['ans_point'];
		$marking=$marking+$point;
		$count++;
	}

	//fetch student data from 
	$sql_get_student="SELECT * FROM student WHERE stud_no='$id'";
	$get_student=mysql_query($sql_get_student);
	$student_data=mysql_fetch_assoc($get_student);
	$a=$student_data['stud_no'];
?>
<table width="780" border="0" align="center">
  <tr>
    <td colspan="3" bgcolor="#999999"><span class="style1">MARKING SECTION</span></td>
  </tr>
  <tr valign="top">
    <td width="278">&nbsp;</td>
    <td width="14">&nbsp;</td>
    <td width="969">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td>Student Name </td>
    <td>:</td>
    <td><?php echo $student_data['stud_name']; ?></td>
  </tr>
  <tr valign="top">
    <td>Student ID Number </td>
    <td>:</td>
    <td><?php echo $student_data['stud_no']; ?></td>
  </tr>
  <tr valign="top">
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td colspan="3"><hr></td>
  </tr>
  <tr valign="top">
    <td colspan="3">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td>Department</td>
    <td>:</td>
    <td><?php echo $q_department; ?></td>
  </tr>
  <tr valign="top">
    <td>Subject</td>
    <td>:</td>
    <td><?php echo $q_subject; ?></td>
  </tr>
  <tr valign="top">
    <td>Topic</td>
    <td>:</td>
    <td><?php echo $q_topic; ?></td>
  </tr>
  <tr valign="top">
    <td>Semester</td>
    <td>:</td>
    <td><?php echo $q_sem; ?></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr>
    <td colspan="3"><hr></td>
  </tr>
  <tr>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td>&nbsp;</td>
  </tr>
  <tr valign="top">
    <td><span class="style4">Total Marks</span> </td>
    <td>&nbsp;</td>
    <td valign="top"><?php echo "<font size=\"5px\" color=\"red\">".$marking."/30"; ?></td>
  </tr>
  <tr valign="top">
    <td>&nbsp;</td>
    <td>&nbsp;</td>
    <td valign="top">&nbsp;</td>
  </tr>
  <tr valign="top">
    <td colspan="3" bgcolor="#999999">&nbsp;</td>
  </tr>
</table><br>

<?php include("../footer.php"); ?>